﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DTO;
using DAO;

namespace Banking.Quản_lý
{
    public partial class ChuyenTienNgoaiNH : UserControl
    {
        TypeDemo _type;
        public ChuyenTienNgoaiNH(TypeDemo type)
        {
            InitializeComponent();
            _type = type;
            LoadDS();
        }
        private void LoadDS()
        {
            dgvDanhSach.DataSource = GiaoDichDA.DSChoChuyenTien();
            dgvDanhSach.Columns["LoaiGD"].Visible = false;
            dgvDanhSach.Columns["TrangThaiGD"].Visible = false;
            dgvDanhSach.Columns["MaATM"].Visible = false;
        }
        private void btnChuyenTien_Click(object sender, EventArgs e)
        {
            int t = dgvDanhSach.SelectedRows.Count;
            for (int i = 0; i < t; i++)
            {
                int maGD = int.Parse(dgvDanhSach.SelectedRows[0].Cells["MaGD"].Value.ToString());
                GiaoDichDA.ThucHienChuyenTien(maGD, 0, _type.typeDemo);
            }
            LoadDS();
        }
    }
}
